@model IEnumerable<ContentCategory>
@using MvcCms.Service.Helpers
@using MvcCms.Data
@{
    string liClassName = "";
    foreach (var category in Model)
    {
        //if there is no parent make sure that it is meant to be shown in nav
        if (category.ParentCategory != null || (category.ParentCategory == null && category.ShowInNav))
        {
            if (Html.IsCurrentRoute(category.CategoryID, "", (category.ParentCategory != null)))
            {
                liClassName = "current";
            }
            else
            {
                liClassName = "";
            }        
            <li class="@liClassName">
            @Html.AreaActionLink(category.Title, "Index", category.Path)
            @if (category.SubCategories.Count > 0)
             {
                <ul>
                    @Html.Partial("ControlsNav/TopNavControl", category.SubCategories)
                </ul>
             }
            </li>
        }
    }
}

